package com.getpebble.android.common.model;

import android.content.ContentValues;
import com.google.gson.annotations.SerializedName;

public class LanguagePack {
    private static final String TAG = LanguagePack.class.getSimpleName();
    @SerializedName("ISOLocal")
    private String ISOLocale;
    @SerializedName("file")
    private String fileUrl;
    @SerializedName("firmware")
    private String firmware;
    @SerializedName("hardware")
    private String hardware;
    @SerializedName("id")
    private String id;
    @SerializedName("name")
    private String languageName;
    @SerializedName("localName")
    private String localizedLanguageName;
    @SerializedName("version")
    private int version;

    public String getFileUrl() {
        return this.fileUrl;
    }

    public String getLanguageName() {
        return this.languageName;
    }

    public String getLocalizedLanguageName() {
        return this.localizedLanguageName;
    }

    public String getHardware() {
        return this.hardware;
    }

    public String getISOLocale() {
        return this.ISOLocale;
    }

    public String getFirmware() {
        return this.firmware;
    }

    public int getVersion() {
        return this.version;
    }

    public String getId() {
        return this.id;
    }

    public boolean isValid() {
        return (getFileUrl() == null || getLanguageName() == null || getLocalizedLanguageName() == null || getHardware() == null || getISOLocale() == null || getFirmware() == null || getVersion() < 0 || getId() == null) ? false : true;
    }

    public ContentValues toContentValues() {
        ContentValues contentValues = new ContentValues(new LanguagePackModel().getNumColumns());
        contentValues.put("file_url", getFileUrl());
        contentValues.put("language_name", getLanguageName());
        contentValues.put("local_language_name", getLocalizedLanguageName());
        contentValues.put("iso_locale", getISOLocale());
        contentValues.put("hw_platform", getHardware());
        contentValues.put("fw_version", getFirmware());
        contentValues.put("language_version", Integer.valueOf(getVersion()));
        contentValues.put("language_uid", getId());
        contentValues.put("numeric_fw_version", Integer.valueOf(LanguagePackModel.getNumericFwVersion(new FirmwareVersion(getFirmware(), 0))));
        return contentValues;
    }
}
